package com.me.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.me.mapper.EmployeeMapper;
import com.me.mapper.GoodsMapper;
import com.me.mapper.MyOrderMapper;
import com.me.mapper.OrderMessageMapper;
import com.me.pojo.Employee;
import com.me.pojo.Enhance;
import com.me.pojo.Goods;
import com.me.pojo.OrderMessage;
import com.me.pojo.User;

public class EmployeeServiceImpl implements EmployeeService 
{
	@Autowired
	private EmployeeMapper employeeMapper;
	
	@Autowired
	private MyOrderMapper myOrderMapper;
	
	@Autowired
	private OrderMessageMapper orderMessageMapper;
	
	@Autowired
	private GoodsMapper goodsMapper;
	
	public EmployeeMapper getEmployeeMapper() {
		return employeeMapper;
	}
	public void setEmployeeMapper(EmployeeMapper employeeMapper) {
		this.employeeMapper = employeeMapper;
	}
	public String login(String username, String password) {
		Employee login=new Employee();
		login.setUsername(username);
		login.setPassword(password);
		int a=employeeMapper.login(login);
		if(a==0)
		{
			return "employeeLogin";
		}
		
		return "employeeBase";	
	}
	public Employee selectEmployee(String username, String password) {
		Employee employee=new Employee();
		employee.setUsername(username);
		employee.setPassword(password);
		return employeeMapper.selectByUP(employee);
	}
	public List<Enhance> selectOrder() {
		return myOrderMapper.selectOrder();

	}
	public Integer selectIdBycode(String code) {
		return myOrderMapper.selectIdBycode(code);
	}
//	public OrderMessage selectOrderMessageByOrderId(Integer id) {
//		return orderMessageMapper.selectOrderMessageByOrderId(id);
//	}
	public List<Enhance> selectEnhanceByOrderId(Integer orderId) {
		return goodsMapper.selectEnhanceByOrderid(orderId);
	}
	public List<Employee> selectAll() {
		return employeeMapper.selectAll();
	}
	public int updateById(Employee employee) {
		return employeeMapper.updateById(employee);
	}
	public List<Enhance> SelectAllEnhance() {	
		return goodsMapper.SelectAllEnhance();
	}


}
